<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script language="javascript">
    
    $(document).ready(function(){
    $("#txtuname").change(function(){
        var usr = $("#txtuname").val();
        if(usr.length >= 4)
        {
            $("#status").html('&nbsp;Checking availability...');
            $.ajax
            ({
                type: "POST",  
                url: "<?php echo $this->baseUrl()."/user/username" ?>",
                data: "txtuname="+ usr,              
                success: function(msgbox)
                {    
              //      $("#status1").html(msgbox);
                    var index_start = msgbox.indexOf("statusCheckEmail") + 18;
                    var index_end = msgbox.indexOf("</div>",index_start);
                    var substr = msgbox.substring(index_start,index_end);
                    $("#status").html(substr);
                    return false;        
                }   
            })
        }
        else
        	{
        	$("#status").html('<font color="red">The username should have at least <strong>4</strong> characters.</font>');
        	$("#txtuname").removeClass('object_ok'); 
        	$("#txtuname").addClass("object_error");
        	}
        })

    })

</script>


<form id="frmAdmin" name="frmAdmin" method="post">
  <table>
    <tr>
      <td><strong>Username: </strong></td>
      <td><label>
        <input type="text" name="txtuname" id="txtuname"  />
        <span>*</span></label>
        <span id="msgbox" style="display:none"></span> </td>
      <td><div id="status"></div></td>  
    </tr>
    
    <tr>
      <td><strong>Email: </strong></td>
      <td><label>
        <input type="text" name="txtEmail" id="txtEmail"  />
        <span>*</span></label>
      <td><div id="status1"></div></td>
    </tr>
    
    <tr><label>
      <td><strong>Password: </strong></td>
      <td>
      <input type="password" name="txtPassword" id="txtPassword" />
            <span>*</span></td></label>
      <td><div id="status3"></div></td>
    </tr>
    <tr>
      <td><strong>Retype password: </strong></td>
      <td><label>
        <input type="password" name="txtRetypePassword" id="txtRetypePassword" />
        <span>*</span></label></td>
      <td><div id="status4"></div></td>
    </tr>
</table>
<p><strong>(* : Required )</strong></p><br />
<p align="left"><input name="btnRegister" type="submit" id="btnRegister" value="Create Account" /></p>
</form>